/*
  +----------------------------------------------------------------------+
  | PHP Version 5                                                        |
  +----------------------------------------------------------------------+
  | Copyright (c) 1997-2009 The PHP Group                                |
  +----------------------------------------------------------------------+
  | This source file is subject to version 3.0 of the PHP license,       |
  | that is bundled with this package in the file LICENSE, and is        |
  | available through the world-wide-web at the following url:           |
  | http://www.php.net/license/3_0.txt.                                  |
  | If you did not receive a copy of the PHP license and are unable to   |
  | obtain it through the world-wide-web, please send a note to          |
  | license@php.net so we can mail you a copy immediately.               |
  +----------------------------------------------------------------------+
  | Author: Kalle Sommer Nielsen <kalle@php.net>                         |
  +----------------------------------------------------------------------+
*/

/* $Id$ */

#ifndef PHP_TWITTER_H
# define PHP_TWITTER_H

extern zend_module_entry twitter_module_entry;
# define phpext_twitter_ptr &twitter_module_entry

# ifdef ZTS
#  include "TSRM.h"
# endif

# define PHP_TWITTER_VERSION	"0.1-dev"

# define TWITTER_ACTION_STATUS	(1 << 1L)
# define TWITTER_ACTION_VERIFY	(1 << 2L)
# define TWITTER_ACTION_REPLY	(1 << 3L)
# define TWITTER_ACTION_TEST	(1 << 4L)

PHP_MINIT_FUNCTION(twitter);
PHP_MINFO_FUNCTION(twitter);

TWITTER_METHOD(__construct);
TWITTER_METHOD(__get);
TWITTER_METHOD(__set);
TWITTER_METHOD(reply);
TWITTER_METHOD(test);
TWITTER_METHOD(update);
TWITTER_METHOD(verify);

ZEND_BEGIN_MODULE_GLOBALS(twitter)
	unsigned short auth_failed;
	unsigned short action;
	size_t datasize;
ZEND_END_MODULE_GLOBALS(twitter)

# ifdef ZTS
#  define TWITTER_G(v) TSRMG(twitter_globals_id, zend_twitter_globals *, v)
# else
#  define TWITTER_G(v) (twitter_globals.v)
# endif

static char *twitter_api_url(unsigned short);
static void twitter_api(INTERNAL_FUNCTION_PARAMETERS, unsigned short);
static void twitter_notification_cb(php_stream_context *, int, int, char *, int, size_t, size_t, void * TSRMLS_DC);

#endif